import 'package:flutter/material.dart';

void main() {
  // MaterialApp 构建 Material 风格的应用
  // Scaffold 脚手架
  // AppBar 顶部标题栏
  runApp(MaterialApp(
    home: Scaffold(
        appBar: AppBar(
          title: const Text('Hello World'), // 标题
          backgroundColor: Colors.pink, // 背景色
          centerTitle: true, // 标题是否居中
        ),
        body: const MyApp(
          age: 19,
        )),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key, this.age = 17});

  final int age;

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Text(
        '我叫玛利亚, 今年: $age岁',
        style: const TextStyle(color: Colors.red, fontSize: 20.0),
      ),
    );
  }
}
